<template>
  <div>
    <el-card class="box">
          <el-switch v-model="value" active-color="#13ce66" inactive-color="grey"></el-switch>
          {{username}}
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: true,
      username:''
    }
  },
  mounted(){
    this.getLedStatus()
  },
  methods:{
     getLedStatus(){
      //  const { data: res } = await this.$http.post('login', this.loginForm)
      this.$axios.get('http://localhost:3000/users/getUserInfo?id=1').then((res)=>{
        this.username = res.data.data.name
      }).catch((res)=>{
        console.log(res)
      })
      // console.log(data)
    }
  }
}
</script>

<style lang="less" scoped>
.box {
  width: 100px;
  height: 65px;
  margin: auto;
  margin-top: 250px;
}


</style>
